package com.spic.business.plan.book.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.spic.business.common.core.domain.BasicEntity;
import com.spic.business.plan.comunication.domain.PlanCommunicationSupport;
import com.spic.business.plan.team.domain.PlanUser;
import com.spic.common.core.annotation.Excel;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * 应急预案台账对象 plan_standing_book
 *
 * @author spic
 * @date 2021-10-28
 */
@Data
public class PlanStandingBook extends BasicEntity
{
    private static final long serialVersionUID = 1L;

    /** 主键 */
    private Long id;

    /** 预案名称 */
    @Excel(name = "预案名称")
    private String name;

    /** 预案编号 */
    @Excel(name = "预案编号")
    private String number;

    /** 预案级别 */
    @Excel(name = "预案级别")
    private String level;

    /** 预案分类 */
    @Excel(name = "预案分类")
    private String classify;

    /** 使用范围 */
    @Excel(name = "使用范围")
    private String useScope;

    /** 签发人 */
    @Excel(name = "签发人")
    private String signPerson;

    /** 签发时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "签发时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date signDate;

    /** 附件 */
    @Excel(name = "备案附件")
    private String recordAttachment;

    /** 附件 */
    @Excel(name = "附件")
    private String attachment;

    /** 是否备案 */
    @Excel(name = "是否备案")
    private String isRecord;

    /** 是否新定制 */
    @Excel(name = "是否新定制")
    private String isCustom;

    /** 启动次数 */
    @Excel(name = "启动次数")
    private Integer startFrequency;

    /** 启动时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "启动时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date startTime;

    /** 应急通讯表ids */
    @Excel(name = "应急通讯表ids")
    private String planCommunicationSupportIds;
    /** 应急人员保障ids */
    @Excel(name = "应急人员保障ids")
    private String planUserIds;

    /** 版本 */
    @Excel(name = "版本")
    private String version;

    /** 预案台账—紧急处理措施信息 */
    private List<PlanStandingBookEmergencyMeasure> planStandingBookEmergencyMeasureList;
    /** 应急通讯保障对象 **/
    private List<PlanCommunicationSupport> planCommunicationSupportList;

    /** 应急通讯保障对象 **/
    private List<PlanUser> planUserList;
    /** 应急物资 **/
    private List<PlanStandingBookGoods> goods;

    /***签发范围*/
    @TableField(exist = false)
    private Date[] signDateRange;

    public void setSignDateRange(Date[] signDateRange){
        this.signDateRange = signDateRange;
        if(signDateRange!= null && signDateRange.length> 0){
            signDateBegin = signDateRange[0];
        }
        if(signDateRange!= null && signDateRange.length >1){
            signDateEnd = signDateRange[1];
        }
    }
    @TableField(exist = false)
    private Date signDateBegin;
    @TableField(exist = false)
    private Date signDateEnd;
}
